<nav id="category_menu" class="category_menu">
    	<div class="menu">
            <ul class="categories">

<?php
for($i=0;$i<sizeof($cat_level12);$i++)
{
?>
                <li class="level0item item<?php echo $i+1;?>" rel="<?php echo $i+1;?>">
                    <span class="parent"><?php echo $cat_level12[$i]['name']?></span>
                    <?php
                    if(isset($cat_level12[$i]['children'])) {
                    ?>
                        <div class="flyout sub_category" style="display:none;">
                            <div class="flyout-background" style="background:url(<?php echo 'image/'.$cat_level12[$i]['image'];?>) no-repeat bottom <?php echo $i>=3 ? 'left' : 'right'; ?>;">
                                <div class="ul_wrapper">
                                	<?php
                                    
                                    if($i>=2) {
                                    ?>
                                    <div class="sub-menu-col <?php echo $i>=3 ? 'flr' : 'fll'; ?>">
                                    <?php
                                    }
                                    	for($j=0;$j<sizeof($cat_level12[$i]['children']);$j++) {
                                        ?>
                                  <?php
                                  if($i<2) {
                                  ?>      
                                  <div class="sub-menu-col <?php if($i==1&&$j==2) echo 'w170 ';?> <?php echo $i>=3 ? 'flr' : 'fll'; ?>">
                                  <?php
                                  }
                                  ?>
                                            <h4><a href="<?php echo $cat_level12[$i]['children'][$j]['href']?>"><?php echo $cat_level12[$i]['children'][$j]['name'];?></a></h4>
                                            <?php
                                            $cat_level34 = $this->model_catalog_category->getAllCategories($cat_level12[$i]['children'][$j]['category_id']);
                                            if(isset($cat_level34)) {
                                            	for($k=0;$k<sizeof($cat_level34);$k++)
                                                {
                                            ?>
                                                <ul class="2level items">
                                                    <li class="level2item"><a href="<?php echo $cat_level34[$k]['href']?>"><?php echo $cat_level34[$k]['name']?></a>
                                                    <?php
                                                    if(isset($cat_level34[$k]['children'])) {
                                                    ?>
                                                    <ul class="3level">
                                                    	<?php
                                                        for($h=0;$h<sizeof($cat_level34[$k]['children']);$h++) {
                                                        ?>
                                                        <li><a href="<?php echo $cat_level34[$k]['children'][$h]['href']?>"><?php echo $cat_level34[$k]['children'][$h]['name']?></a></li>
                                                        <?php 
                                                        }
                                                        ?>
                                                    </ul>
                                                    <?php 
                                                    }
                                                    ?>
                                                    </li>
                                                    
                                                </ul>
                                    <?php
                                            	}
                                            }
                                            ?>
                                    <?php if($i<2)  {
                                    ?>
                                    </div>
                                    <?php }
                                    ?>
                                        <?php
                                        }
                                    ?>
                                    <?php if($i>=2)  {
                                    ?>
                                    </div>
                                    <?php }
                                    ?>
                                    
                            	</div>
                            </div>
                        </div>
                    <?php
                    }
                    ?>
                </li>    
<?php
}
?>
            </ul>
        </div>
</nav>

<?php return;?>
<nav id="category_menu" class="category_menu">
    	<div class="menu">
            <ul class="categories">
                <li class="level0item item1" rel="1">
                    <span class="parent">Outdoor</span>
                    <div class="flyout sub_category" style="display:none;">
                        <div class="flyout-background" style="background:url(catalog/view/theme/default/img/sub-menu-bg-01.jpg) no-repeat bottom right;">
                            <div class="ul_wrapper">
        						<div class="sub-menu-col fll">
                                	<h4>Furniture</h4>
                                    <ul class="2level items">
                                        <li class="level2item"><a href="products.php">Mix (wood/metal)</a></li>
                                        <li class="level2item"><a href="products.php">Metal</a></li>
                                        <li class="level2item"><a href="products.php">Resin Wicker</a></li>
                                        <li class="level2item">
                                        	<a href="products.php">Wood</a>
                                            <ul class="3level">
                                            	<li><a href="products.php">Acacia</a></li>
                                                <li><a href="products.php">Balau</a></li>
                                                <li><a href="products.php">Eucalyptus</a></li>
                                                <li><a href="products.php">Teak</a></li>
                                            </ul>
                                        </li>
                                    </ul>
                                </div>
                                <div class="sub-menu-col fll">
                                	<h4>Pottery</h4>
                                    <ul class="2level items">
                                        <li class="level2item"><a href="products.php">Terracotta</a></li>
                                        <li class="level2item"><a href="products.php">Poly-stone</a></li>
                                        <li class="level2item"><a href="products.php">Terrazzo</a></li>
                                         <li class="level2item"><a href="products.php">Light cement</a></li>
                                        <li class="level2item"><a href="products.php">Zinc</a></li>
                                        <li class="level2item"><a href="products.php">Natural fiber</a></li>
                                         <li class="level2item"><a href="products.php">Resin wicker</a></li>
                                    </ul>
                                </div>
                                
                                <div class="sub-menu-col fll">
                                	<h4>Accessories</h4>
                                    <ul class="2level items">
                                        <li class="level2item"><a href="products.php">Tiles</a></li>
                                        <li class="level2item"><a href="products.php">Candles</a></li>
                                        <li class="level2item"><a href="products.php">Torches</a></li>
                                        <li class="level2item"><a href="products.php">Lamps</a></li>
                                    </ul>
                                </div>
                                
                            </div>
                        </div>
                    </div>
                 </li>
                 
                 <li class="level0item item2" rel="2">
                    <span class="parent">Indoor</span>
                    <div class="flyout sub_category" style="display:none;">
                        <div class="flyout-background" style="background:url(catalog/view/theme/default/img/sub-menu-bg-02.jpg) no-repeat bottom right;">
                            <div class="ul_wrapper">
        						<div class="sub-menu-col fll">
                                	<h4>Furniture</h4>
                                    <ul class="2level items">
                                        <li class="level2item"><a href="products.php">Wood</a></li>
                                    </ul>
                                    <h4>Pottery</h4>
                                    <ul class="2level items">
                                        <li class="level2item"><a href="products.php">Ceramics</a></li>
                                        <li class="level2item"><a href="products.php">Natural fiber</a></li>
                                        <li class="level2item"><a href="products.php">Resin wicker</a></li>
                                    </ul>
                                </div>
                                
                                
                                <div class="sub-menu-col w170 fll">
                                	<h4>Deco &amp; Accessories</h4>
                                    <ul class="2level items">
                                        <li class="level2item"><a href="products.php">Wooden pictures</a></li>
                                        <li class="level2item"><a href="products.php">Torches</a></li>
                                        <li class="level2item"><a href="products.php">Candles</a></li>
                                        <li class="level2item"><a href="products.php">Lighting (Lamps)</a></li>
                                    </ul>
                                </div>
                                
                            </div>
                        </div>
                    </div>
                 </li>
                 
                 <li class="level0item item3" rel="3">
                    <span class="parent">Elinea Design collections</span>
                    <div class="flyout sub_category" style="display:none;">
                        <div class="flyout-background" style="background:url(catalog/view/theme/default/img/sub-menu-bg-03.jpg) no-repeat bottom right;">
                            <div class="ul_wrapper">
        						<div class="sub-menu-col fll">
                                    <h4><a href="ed-collections.php">Furniture</a></h4>
                                    <h4><a href="ed-collections.php">Pottery</a></h4>
                                    <h4><a href="ed-collections.php">Deco</a></h4>
                                </div>
                            </div>
                        </div>
                    </div>
                 </li>
                 
                 <li class="level0item item4" rel="4">
                    <span class="parent">Best sellers</span>
                    <div class="flyout sub_category" style="display:none;">
                        <div class="flyout-background" style="background:url(catalog/view/theme/default/img/sub-menu-bg-04.jpg) no-repeat bottom left;">
                            <div class="ul_wrapper">
        						<div class="sub-menu-col flr">
                                    <h4><a href="best-sellers.php">Furniture</a></h4>
                                    <h4><a href="best-sellers.php">Pottery</a></h4>
                                    <h4><a href="best-sellers.php">Deco</a></h4>
                                </div>
                            </div>
                        </div>
                    </div>
                 </li>
                 
                 <li class="level0item item5" rel="5">
                    <span class="parent">Promotions</span>
                    <div class="flyout sub_category" style="display:none;">
                        <div class="flyout-background" style="background:url(catalog/view/theme/default/img/sub-menu-bg-05.jpg) no-repeat bottom left;">
                            <div class="ul_wrapper">
        						<div class="sub-menu-col flr">
                                    <h4><a href="promotions.php">Furniture</a></h4>
                                    <h4><a href="promotions.php">Pottery</a></h4>
                                    <h4><a href="promotions.php">Deco</a></h4>
                                </div>
                            </div>
                        </div>
                    </div>
                 </li>
                 
            </ul>
        </div>
    </nav>